#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

void move(char a, char c)
{
	printf("%c->%c\n", a, c);
}

void hannuota(int n, char a, char b, char c)
{
	if (n == 1)
	{
		move(a, c);
	}
	else
	{
		hannuota( n - 1, a, c,  b);
		move(a, c);
		hannuota(n - 1, b, a, c);
	}
}

int main()
{
	char a = 'A', b = 'B', c = 'C';
	int n;
	scanf("%d", &n);
	hannuota(n,a,b,c);
	return 0;
}